#页面类
from Day16zy.Base import Base
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from time import sleep
class Page(Base):
    #定位器
    search_loc=(By.NAME,'key')
    #页面元素的封装
    #登录
    dl = (By.PARTIAL_LINK_TEXT, '登录')
    #输入账号
    username=(By.ID,'TANGRAM__PSP_11__userName')
    #输入密码
    password=(By.XPATH,'//*[@id="TANGRAM__PSP_11__password"]')
    #协议
    xieyi=(By.XPATH,'//*[@id="TANGRAM__PSP_11__isAgree"]')
    #登录按钮
    button=(By.ID,'TANGRAM__PSP_11__submit')

    def search(self):
        #登录
        self.click(self.dl)
        sleep(5)
        #账号
        self.send_keys(self.username,'17733058407')
        sleep(2)
        #密码
        self.send_keys(self.password,'Li10140910')
        sleep(2)
        #勾选协议
        self.click(self.xieyi)
        sleep(2)
        #点击登录
        self.click(self.button)
        sleep(10)


    #业务逻辑
    def luoji_jiuxian_01(self):
        self.open_url('https://www.baidu.com/')
        self.search()
        sleep(5)